<!DOCTYPE html>
<html>
#{include file="header.html"}#
<body class="gray-bg">
<div class="ibox-content">
  <form class="form-horizontal" method="post" action="#">
    <input type="hidden" name="category_id" value="#{$one.category_id}#">
    <div class="form-group">
      <label class="col-sm-2 control-label">分类名称：</label>
      <div class="col-sm-8">
        <input name="category_name" class="form-control" type="text" value="#{$one.category_name}#" placeholder="请输入分类名称" required/>
      </div>
    </div>
    <div class="form-group">
      <label class="col-sm-2 control-label">分类简称：</label>
      <div class="col-sm-8">
        <input name="short_name" class="form-control" type="text" value="#{$one.short_name}#" placeholder="请输入分类简称" required/>
      </div>
    </div>
    <div class="form-group">
      <label class="col-sm-2 control-label">上级分类：</label>
      <div class="col-sm-8"> #{$parent_id}# </div>
    </div>
    <div class="form-group">
      <label class="col-sm-2 control-label">排序：</label>
      <div class="col-sm-8">
        <input name="sort" class="form-control" type="digits" value="#{$one.sort}#" placeholder="栏目排序号"/>
      </div>
    </div>
    <div class="form-group">
      <label class="col-sm-2 control-label">是否启用：</label>
      <div class="col-sm-8">
        <div class="checkbox i-checks">
          <input type="checkbox" name="visible" value="1" #{if $one.visible eq 1 }# checked #{/if}#/>
        </div>
      </div>
    </div>
    <div class="form-group">
      <label class="col-sm-2 control-label">关键字：</label>
      <div class="col-sm-8">
        <input name="keywords" class="form-control" type="text" value="#{$one.keywords}#" placeholder="请输入分类名称" required/>
        <span class="help-block m-b-none">用于网站搜索引擎的优化，关键字之间请用英文逗号分隔</span> </div>
    </div>
    <div class="form-group">
      <label class="col-sm-2 control-label">描述：</label>
      <div class="col-sm-8">
        <textarea name="description" class="form-control" cols="80" rows="2">#{$one.description}#</textarea>
      </div>
    </div>
    <div class="form-group">
      <div class="col-sm-offset-2 col-sm-8">
        <button class="btn  btn-w-m btn-info save-form" type="button">保存数据</button>
      </div>
    </div>
  </form>
</div>
<script>
$(document).ready(function () {
	$('.i-checks').iCheck({
		checkboxClass: 'icheckbox_square-green',
		radioClass: 'iradio_square-green',
	});
	
	//数据保存
	$("body").on("click", ".save-form", function() {
		FormData=$("form").serialize();
		$.ajax({
			type: "POST",
			url: "#{$smarty.const.ACT}#/goods/GoodsCategory/goods_category_modify/",
			data:FormData,
			dataType:"json",
			success: function(data){
				if(data.statusCode=='200'){
					layer.msg('操作成功', {icon: 1}); 		
				}
			},    
			complete: function() {   
				setTimeout(function(){
					//关闭窗口
					var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
					parent.layer.close(index);
				 },800);
   		  },
		});		
	});
	
});
    </script>
</body>
</html>
